<template>
  <div class="">
    <!-- 题目审核的列表 -->
    <el-dialog
      title="题目审核"
      :visible="dialogFormVisible"
      width="25%"
      @close="handle"
    >
      <el-form :model="form">
        <el-form-item>
          <el-radio v-model="form.haha" label="1">通过</el-radio>
          <el-radio v-model="form.haha" label="2">拒绝</el-radio>
        </el-form-item>
        <el-form-item>
          <el-input
            type="textarea"
            v-model="form.desc"
            placeholder="请输入审核意见"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="handle">取 消</el-button>
        <el-button type="primary" @click="request">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from "@/api/hmmm/questions.js";
export default {
  name: "",
  props: {
    dialogFormVisible: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      form: {
        haha:'1',
        desc: "",
      },
      formLabelWidth: "120px",
      userids:''
    };
  },

  components: {},
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    handle() {
      // this.dialogFormVisible=false
      this.$emit("update:dialogFormVisible", false);
    },
    userid(id){
      this.userids=id
    },
    async request(id) {
      // console.log(this.form.desc);
      // console.log(this.form.haha);
      // console.log(row.id);
      //  按下确定的时候调接口
      // console.log(this.$refs.abc.label);
      if (this.form.desc.length == 0) {
        this.$message({
          message: "请输入审核意见",
          type: "warning",
        });
      }else{
        const res = await choiceCheck({
          id: this.userids,
          chkState: this.form.haha-0,
          chkRemarks: this.form.desc
        });
        this.userids = '',
        this.form.haha = '',
        this.form.desc = ''
        this.$emit("update:dialogFormVisible", false);
        // console.log(res);
        // this.$parent.Refreshss()
        this.$emit('Refresh')
      }
      
    },
  },
};
</script>

<style scoped lang='less'>
</style>
